#dispatch-environment.sh
source /opt/k8s/bin/environment.sh

for i in "${!NODE_IPS[@]}";
  do
    node_ip=${NODE_IPS[$i]}
    node_port=${NODE_PORTS[$i]}
 
    echo ">>> ${node_ip}:${node_port} "
    ssh -p ${node_port} k8s@${node_ip} "mkdir -p /etc/kubernetes/cert && chown -R k8s /etc/kubernetes" 
    scp -P ${node_port} ca*.pem ca-config.json  k8s@${node_ip}:/etc/kubernetes/cert
  done
